﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LiveSequence.Common.Domain;
using LiveSequence.Interface;
using LiveSequence.Suite.Domain;

namespace LiveSequence.Suite.Documents
{
  public class ProjectDoc : BaseDoc
  {
    public ProjectDoc(LSProject project)
    {
      Title = "Project";
      IsDirty = false;
      Project = project;
    }

    public LSProject Project
    {
      get; set;
    }

    #region Public Methods
    public void CrearDiagram()
    {
      
    }
    #endregion

    #region Overrides

    #endregion Overrides

    #region Operations
    public void CreateDiagram(string name, string type, string @namespace, string assembly)
    {
      SequenceData sequenceData = AssemblyExplorer.Instance.GetSequenceData(name, type, @namespace, assembly);

      LSMethodCallDiagram diagram = new LSMethodCallDiagram(name, type, @namespace, assembly, sequenceData);

      Project.Diagrams.Add(diagram);

      OnUpdateAllViews(null,null);

    }

    public void CreateDiagram(string name, 
                              string type, 
                              string @namespace, 
                              string assembly, 
                              SequenceData sequenceData)
    {

      LSMethodCallDiagram diagram = new LSMethodCallDiagram(name, type, @namespace, assembly, sequenceData);

      Project.Diagrams.Add(diagram);

      OnUpdateAllViews(null, null);

    }

    #endregion Operations

    internal void AddDiagram(SeqDiagramDoc seqDiagramDoc)
    {
      Project.Diagrams.Add(seqDiagramDoc.Diagram);
      OnUpdateAllViews(null, null);
    }

    internal void RemoveDiagram(LSMethodCallDiagram diagram)
    {
      Project.Diagrams.Remove(diagram);
      OnUpdateAllViews(null, null);
    }
  }
}
